# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-tzinfo
_gemname=tzinfo
pkgver=2.0.6
pkgrel=1
pkgdesc="Ruby Timezone Library"
url="https://github.com/tzinfo/tzinfo"
arch="noarch"
license="MIT"
depends="
	ruby
	ruby-concurrent-ruby
	tzdata
	"
checkdepends="
	ruby-bundler
	ruby-minitest
	ruby-rake
	"
source="https://github.com/tzinfo/tzinfo/archive/v$pkgver/ruby-tzinfo-$pkgver.tar.gz
	no-coverage.patch
	rakefile-ruby-3.3-compat.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

prepare() {
	default_prepare

	sed -i '/gem .simplecov./d' Gemfile
}

build() {
	gem build $_gemname.gemspec
}

check() {
	bundle exec rake test
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"
	local geminstdir="$gemdir/gems/$_gemname-$pkgver"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	# Remove unnecessary files and rubbish...
	cd "$gemdir"
	rm -r cache build_info doc extensions plugins

	cd "$geminstdir"
	rm LICENSE ./*.md
}

sha512sums="
88af68b13becc4b6b85b4653df95e19e24d8804ac2b2393ef03cfe551b5eaee827a5aecd2156a56572d554dd5239ae828a65e5c49854671aa1989f5c31ba320d  ruby-tzinfo-2.0.6.tar.gz
9264055dfea591763768f628ea04ee99e04e36abb1602ef06b35e522c47402625c072384a1ff2f65ece53dfc68220c1299e9fb1b9248954a304415a26cc40766  no-coverage.patch
a91b80e61cd5bda63c06604e7a94a3c61486dc40dfddd4155c047b4128979d1185bdfff35cc29a3b94e5108902897e3011f62cbd1c0eadf4c276a2e701256ddb  rakefile-ruby-3.3-compat.patch
"
